package com.gs.weather.dao;

import com.gs.weather.dao.mapper.MicapsGeologyMapper;
import com.gs.weather.entity.MicapsResolve;
import com.gs.weather.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Legolas
 * Date: 2017/9/21 0021
 */
@Repository
public class MicapsGeologyDao {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    MicapsGeologyMapper mapper;

    public void addGeology(List<MicapsResolve> micapsResolves){
        try {
            mapper.addGeology(micapsResolves);
            logger.info("micapsResolves添加成功");
        } catch (Exception e) {
            logger.info("addGeology失败->{}",e.getMessage());
        }
    }

    public List<MicapsResolve> queryGeology(String type){
        //生成数据存在一小时延迟
        try {
            return mapper.queryGeology(type, DateUtils.getYearToMinuteTest());
        } catch (Exception e) {
            logger.info("queryGeology失败->{}",e.getMessage());
        }

        return null;
    }

    public List<String> queryArea(String type){
        try {
            return mapper.queryArea(type, DateUtils.getYearToMinuteTest());
        }catch (Exception e){
            logger.info("queryArea失败->{}",e.getMessage());
        }
        return  null;
    }




}
